#!/bin/bash

getopt -Qn 'Error' hm:p:t: "$@"
if [ $# -eq 0 ];
then echo usage: reset_partition -m [\"managed system\"] -p [\"partition name\"] -t [reset type]
exit 1
fi
if [ $1 = '-h' ];
then echo
echo usage: reset_partition -m [\"managed system\"] -p [\"partition name\"] -t [reset type]
echo '     ' reset a partition on the managed system
echo '     ' NOTE: If the partition name is the same as the managed system, this is taken
echo '           ' as a request to reset the managed system itself.
echo
echo Options:
echo '   ' -m the name of the managed system enclosed enclosed in double quotes \" \"
echo '   ' -p the name of the partition to be reset enclosed in double quotes \" \"
echo '   ' -t the reset type
echo '   ' -h brings up this help screen
echo reset type:
echo '   ' hard - issue a Hard Reset
echo '   ' soft - issue a Soft Reset, similar to an operating system reset
echo
exit 0
fi

export CLASSPATH=/usr/websm/codebase/pluginjars/hmcdebug.jar:/opt/hsc:/usr/websm/codebase/pluginjars/sniacimom.jar:/usr/websm/codebase/pluginjars/xerces.jar:/usr/websm/codebase/pluginjars/HwmcaCommon.jar:/usr/websm/codebase/pluginjars/auifw.jar:$CLASSPATH
export PATH=/opt/IBMJava2-13/jre/bin:$PATH

if [ $# -eq 6 ];
then java -Djavax.net.ssl.keyStore=/usr/websm/codebase/SM.pubkr -Djavax.net.ssl.keyStorePassword=defp -DcimomConfigFile=/opt/hsc/data/cimomcfg.properties com.ibm.hsc.common.util.ResetPartition "\"$2\"" "\"$4\"" $6
exit 0
fi
echo usage: reset_partition -m [\"managed system\"] -p [\"partition name\"] -t [reset type]
exit 1

